package com.skytech.tax.customsdatawarehouse.singlewindow.customsdeclarations.domain.entity;

import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang.StringUtils;

import java.io.Serializable;

/**
 * 进出口关单（单一窗口）
 */
public class IECustomsDeclaration implements Serializable {

    private String cusCiqNo;               //统一编号
    private String customsDeclaration;     //报关单信息
    private String storageTime;            //入库时间
    private String updateTime;              //更新时间
    private String ciqIEFlag;               //进出口标识
    private String entryId;                 //报关单号
    private String socialCreditCode;        //企业社会信用代码

    public IECustomsDeclaration() {
    }

    public IECustomsDeclaration(String cusCiqNo, String socialCreditCode, JSONObject customsDeclaration) {
        this.cusCiqNo = cusCiqNo;
        this.socialCreditCode = socialCreditCode;
        this.updateTime = customsDeclaration.getString("updateTime");
        String ieFlag = customsDeclaration.getString("ciqIEFlag");
        this.ciqIEFlag = StringUtils.isBlank(ieFlag) ? cusCiqNo.substring(0, 1) : ieFlag;
        this.entryId = customsDeclaration.getString("entryId");
        this.customsDeclaration = customsDeclaration.toJSONString();
    }

    public String getCusCiqNo() {
        return cusCiqNo;
    }

    public void setCusCiqNo(String cusCiqNo) {
        this.cusCiqNo = cusCiqNo;
    }

    public String getCustomsDeclaration() {
        return customsDeclaration;
    }

    public void setCustomsDeclaration(String customsDeclaration) {
        this.customsDeclaration = customsDeclaration;
    }

    public String getStorageTime() {
        return storageTime;
    }

    public void setStorageTime(String storageTime) {
        this.storageTime = storageTime;
    }

    public String getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }

    public String getCiqIEFlag() {
        return ciqIEFlag;
    }

    public void setCiqIEFlag(String ciqIEFlag) {
        this.ciqIEFlag = ciqIEFlag;
    }

    public String getEntryId() {
        return entryId;
    }

    public void setEntryId(String entryId) {
        this.entryId = entryId;
    }

    public String getSocialCreditCode() {
        return socialCreditCode;
    }

    public void setSocialCreditCode(String socialCreditCode) {
        this.socialCreditCode = socialCreditCode;
    }
}
